from machine import Pin
import utime

# LED闪烁
def led_flash(leds):
    for led in leds:
        led.value(1)
    utime.sleep_ms(200)
    for led in leds:
        led.value(0)
    utime.sleep_ms(200)
        

# 跑马灯
def led_horse(leds):
    for led in leds:
        led.value(not led.value())
        utime.sleep_ms(200)

# 流水灯
def led_water(leds):
    for led in leds:
        led.value(1)
        utime.sleep_ms(200)
        led.value(0)
    
if __name__ == "__main__":
    pins = [14, 27, 26, 25, 33, 32, 16, 17]
    leds = [Pin(pin, Pin.OUT, value=0) for pin in pins]
    while True:
        led_flash(leds)
        led_flash(leds)
        led_flash(leds)
        led_horse(leds)
        led_horse(leds)
        led_horse(leds)
        led_water(leds)
        led_water(leds)
        led_water(leds)




